Add a 'static_tags' option to disable automatic merging of tags#131
Add a 'static_tags' option to disable automatic merging of tags#131Makeshift wants to merge 4 commits intocloudposse:masterfrom
Conversation
|
/test all |
There was a problem hiding this comment.
@Makeshift Thank you for this contribution.
I think I understand the problem, though maybe you want to explain it in further detail, because it does not look to me like this PR solves the problem.
As I understand it, the issue is that the current AWS provider does not like it when a resource's tags have the same keys as the provider's default_tags. However, in some cases, modules add tags that are critical to proper functioning of the module, such as tagging resources as managed by an autoscaler or belonging to a Kubernetes cluster. So we cannot allow an option that blocks modules from adding tags.
To me this suggest 2 reasonable solutions:
- Tell people not to use the
default_tagsoption to the provider and instead implementdefault_tagsin null-label and have people use null-label'stagsoutput. This has the added advantage of properly allowing tags to be overridden, which the AWS provider seem not to support. Of course the disadvantage is that this does not cover any resources created by modules that do not use null-label. And in fact, we do not even need a new input for this. Simply setting the currenttagsinput with the set of default tags in a base null-label module in the root module would do it. - Add some input like
suppress_tagswhich provides a list of tag keys to filter out of thetagsoutput, so those tags are not set in resources. The trade-off here is that while this ensures all resources get the default tags via the provider, the default tags cannot be overridden.
@Makeshift What do you think of those solutions?
|
You're correct in your assessment - Thank you for pointing out the flaw in disabling tags, it didn't occur to me that they could be integral to the working of certain resources/services. Do you have an example of a module that does this so I can make sure that any changes I make doesn't break it?
That disadvantage is rather a large one, unfortunately, I believe that
This seems like a reasonable compromise. You're suggesting something along the lines of allowing the user to set ? Edit: I've implemented and committed what I think you were proposing, let me know :) |
…g generation of tags entirely
|
/test all |
|
@Makeshift I hope you do not mind, I am going to steal this idea and some of this code and re-implement it in my current PR, rather than ask you to make additional changes. |
what
static_tags, set to false by default, which stops the module from merging in new tags and instead uses thetagsvariable in the input as-is, including handing it off to other modules as necessarywhy
cloudpossemodules can be useful in certain circumstancesI have a fork of
terraform-null-labelthat removes tags that interfere with providerdefault_tags, but this isn't obeyed by downstream cloudposse modules. This PR should make it possible to pass context in and force null_label to not make any tags, or only make a subset of the tags :)references